<!-- 每日任务 -->
<template>
	<view class="daily-tasks">
		<view class="daily-tasks-header"></view>
		<view class="daily-tasks-body">
			<view class="dt_title">
				做任务 领盲盒
			</view>
			<view class="dt_list">
				<block v-for="(item,index) in dataList" :key="index">
					<view class="dt_li" v-if="item.type == 1">
						<view class="dt_li_left">
							<view class="dt_li_img">
								<image class="imgBox" src="/static/blindbox/kaa01.png" mode=""></image> 
							</view>
							<view class="dt_li_word">
								<text class="title">{{item.title}}</text>
								
								<text class="subtitle" v-if="item.prizeType == 1">盲盒优惠券+{{item.boxCouponNum}}</text>
								<text class="subtitle" v-else-if="item.prizeType == 2">{{item.equityCardName}}+{{item.equityCardNum}}</text>
								<text class="subtitle" v-else-if="item.prizeType == 3">赠送{{item.cocoNum}}CoCo</text>
								<text class="subtitle" v-else-if="item.prizeType == 4">赠送{{item.tfNum}}通分</text>
								<!-- <text class="subtitle" v-else-if="item.prizeType == 3">盲盒优惠券+{{item.boxCouponNum}}、{{item.equityCardName}}+{{item.equityCardNum}}</text> -->
							</view>
						</view>
						<view class="dt_li_but op" v-if="item.status == 2">
							已完成
						</view>
						<navigator class="dt_li_but" url="/pages/my/certification/certification?task=true" hover-class="none" v-else>
							前往
						</navigator>
					</view>
					
					<view class="dt_li" v-else-if="item.type == 2">
						<view class="dt_li_left">
							<view class="dt_li_img"><image class="imgBox" src="/static/blindbox/kaa02.png" mode=""></image> </view>
							<view class="dt_li_word">
								<text class="title">{{item.title}}({{item.completed}}/{{item.total}})</text>
								<!-- <text class="subtitle" v-if="item.prizeType == 1">{{item.total}}人助力，盲盒优惠券+{{item.boxCouponNum}}</text>
								<view class="subtitle" v-else-if="item.prizeType == 2">{{item.total}}人助力，<block v-for="(eq,eqIndex) in item.equityCardConfigList" :key="eqindex"><text v-if="eqIndex != 0">、</text> {{eq.equityCardName}}+{{eq.equityCardNum}}</block></view>
								<text class="subtitle" v-else-if="item.prizeType == 3">{{item.total}}人助力，盲盒优惠券+{{item.boxCouponNum}}<block v-for="(eq,eqIndex) in item.equityCardConfigList" :key="eqindex">、{{eq.equityCardName}}+{{eq.equityCardNum}}</block></text> -->
								<view class="subtitle">
									<text>{{item.total}}人助力，</text>
									<text v-if="item.boxCouponNum!=''" style="margin-right: 10rpx;"> 盲盒优惠券+{{item.boxCouponNum}}</text>
									<text v-if="item.cocoNum!=''" style="margin-right: 10rpx;">赠送{{item.cocoNum}}CoCo</text>
									<text v-if="item.tfNum!=''" style="margin-right: 10rpx;">赠送{{item.tfNum}}通分</text>
								</view>
							</view>
						</view>
						<view class="dt_li_but op" v-if="item.status == 2">
							已完成
						</view>
						<view class="dt_li_but" @click="invitation" v-else>
							去邀请
						</view>
					</view>
					
					<view class="dt_li" v-else>
						<view class="dt_li_left">
							<view class="dt_li_img"><image class="imgBox" :src="item.elseImg" mode=""></image></view>
							<view class="dt_li_word">
								<text class="title">{{item.elseTitle}}</text>
								<text class="subtitle">{{item.elseContent}}</text>
							</view>
						</view>
						<navigator class="dt_li_but" url="/pages/my/customer-service/customer-service">
							联系客服
						</navigator>
					</view>
				</block>

			</view>
		</view>

		<invitation-tasks ref="child"></invitation-tasks>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				dataList:[]
			}
		},
		onLoad() {
			this.getMissionList()
		},
		onHide() {
			uni.removeStorageSync('person-card');
		},
		methods: {
			async getMissionList(){
				const res = await this.$api.getMissionList();
				this.dataList = res.result
			},
			invitation() {
				this.$refs.child.open();
			},

		}
	}
</script>

<style scoped>
	page {
		width: 100%;
		height: 100%;
	}

	.daily-tasks {
		width: 100%;
		height: 100%;
		position: relative;
	}

	.daily-tasks-header {
		position: absolute;
		z-index: 2;
		width: 750rpx;
		height: 278rpx;
		background: url('/static/blindbox/daily-tasks-header.png') no-repeat;
		background-size: 100% 100%;
	}

	.daily-tasks-body {
		position: absolute;
		z-index: 3;
		width: 750rpx;
		top: 252rpx;
		min-height: calc(100% - 252rpx);
		background: #F6F6F6 url('/static/blindbox/daily-tasks-bg.png') no-repeat;
		background-size: 100% 100%;
		border-radius: 40rpx 40rpx 0px 0px;
		padding-bottom: 80rpx;
	}

	.dt_title {
		width: 340rpx;
		/* height: 70rpx; */
		background: #9DFBFF;
		border-radius: 0px 0px 32rpx 32rpx;
		font-weight: 400;
		font-size: 36rpx;
		padding: 10rpx 0;
		margin: 0 auto;
		text-align: center;
		color: #016996;
	}

	.dt_list {
		display: flex;
		flex-direction: column;
		align-items: center;
		margin-top: 60rpx;
	}

	.dt_list .op {
		opacity: .5;
	}

	/* 列表 */
	.dt_li {
		width: 670rpx;
		padding: 24rpx;
		background: #FFFFFF;
		border-radius: 16rpx;
		margin-bottom: 24rpx;
		display: flex;
		flex-direction: row;
		justify-content: space-between;
		align-items: center;
	}

	.dt_li_left {
		display: flex;
		flex-direction: row;
		align-items: center;
	}

	.dt_li_img {
		width: 92rpx;
		height: 92rpx;
		background: #FEF9E5;
		border-radius: 50%;
		overflow: hidden;
	}

	.dt_li_word {
		display: flex;
		flex-direction: column;
		margin-left: 24rpx;
	}

	.dt_li_word .title {
		font-weight: 400;
		font-size: 32rpx;
		margin-bottom: 10rpx;
		color: #222222;
	}

	.dt_li_word .subtitle {
		font-weight: 400;
		font-size: 26rpx;
		color: #666666;
		width: 364rpx;
	}

	.dt_li_but {
		width: 140rpx;
		height: 52rpx;
		background: linear-gradient(180deg, #F9856B 0%, #FD4346 100%);
		box-shadow: 0px 4rpx 8rpx #FFCECB;
		border-radius: 200rpx;
		font-size: 24rpx;
		color: #ffffff;
		line-height: 52rpx;
		text-align: center;
	}


</style>
